<{include file="Public/head.tpl"}>

<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap-table/1.8.1/bootstrap-table.min.css">
<link rel="stylesheet" href="/admin/plugins/daterangepicker/daterangepicker-bs3.css">

<{include file="Public/header.tpl"}>
<{include file="Public/siderbar.tpl"}>
<{include file="Public/contentheader.tpl"}>
	<section class="content">	
		 <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                    
                      <input name="start" class="form-control" value="" type="text" placeholder="开始时间" readonly style="width:10%; display: inline;"/>
                      <input name="end" class="form-control" value="" type="text" placeholder="结束时间" readonly style="width:10%; display: inline;"/>
                      <button class="btn btn-primary btn-flat" style="vertical-align:baseline;" onclick="del();">删除</button>
                   
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table data-toggle="table"
                               data-url="/admin/sys/log" 
                               data-method="post"
                               data-content-type="application/x-www-form-urlencoded"
                               data-side-pagination="server" 
                               data-pagination="true" 
                               data-search="true"
                               data-show-columns="true"
                               data-show-export="true"
                               data-show-refresh="true"
                               data-response-handler="responseHandler">
                            <thead>
                                <tr>
                                    <th data-field="id" data-align="left">日志ID</th>
                                    <th data-field="operator" data-align="left">操作人</th>
                                    <th data-field="operate" data-align="left">操作内容</th>
                                    <th data-field="uri" data-align="left">uri</th>
                                    <th data-field="ip" data-align="center">ip</th>
                                    <th data-field="createtime" data-align="center">时间</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
	</section>
</div>
  
<{include file="Public/footer.tpl"}>

<!-- Tables -->
<script src="/admin/plugins/daterangepicker/moment.js"></script>
<script src="/admin/plugins/daterangepicker/daterangepicker.js"></script>
<script src="http://cdn.bootcss.com/bootstrap-table/1.8.1/bootstrap-table.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap-table/1.8.1/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap-table/1.8.1/extensions/export/bootstrap-table-export.min.js"></script>
<script src="/admin/plugins/tableexport/tableexport.js"></script>
<!-- page script -->
<script>
	function responseHandler(res){
		return res;
	}
	
	function del(){		
		bootbox.setLocale("zh_CN");
	    var posturl = "/admin/sys/dellog";;
	   	var start = $("input[name='start']").val();
	   	var end = $("input[name='end']").val();
	   	if(!start||!end){
	   		bootbox.alert("请选择开始,结束时间");
	   		return false;
	   	}
	   	if(start>=end){
	   		bootbox.alert("开始时间不能大于等于结束时间");
	   		return false;
	   	}
		$.ajax({
			url : posturl,
			type : 'post',
			data : 'start=' + start + '&end=' + end,
			success : function(data) {
				var ret = JSON.parse(data);		
				bootbox.alert(ret.data);
			}
		});
		
	}
	
	$(function(){
		$("input[name='start'],input[name='end']").daterangepicker({
			format: 'YYYY-MM-DD',
			singleDatePicker:true
		});
	})
	
</script>
</body>
</html>